package run;

import com.SpringBootApps;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.support.GenericApplicationContext;
import utils.Utils;

import java.lang.ref.WeakReference;

@SpringBootTest(classes = {StartUpAsInternalServer.Dummy.class},
        webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
public class StartUpAsInternalServer {
    Object lock = new Object();
    @Autowired
    GenericApplicationContext applicationContext;
    @Test
    public void verify() throws InterruptedException {


        Utils.print(applicationContext);
        synchronized (lock) {
            lock.wait();
        }
    }

    @Import(value = SpringBootApps.class)
    @Configuration
    public static class Dummy {
    }

}
